﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAO_DTO_WS.DAO;
using DAO_DTO_WS.DTO;

namespace LayoutTemplate
{
    public partial class DoanhNghiep_ThongTin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
        {

        }

        protected void tbWebsite_TextChanged(object sender, EventArgs e)
        {

        }

        protected void btnCapNhat_Click(object sender, EventArgs e)
        {
            ThanhVienDTO thanhvien = ThanhVienDAO.LayThanhVien(Session["TenDangNhap"].ToString());
            DoanhNghiepDTO doanhnghiep = DoanhNghiepDAO.LayDNTheoTenDangNhap(Session["TenDangNhap"].ToString());
            if (string.Compare(tbTenDoanhNghiep.Text, string.Empty, true) != 0)
            {
                doanhnghiep.TenDoanhNghiep = tbTenDoanhNghiep.Text;
                thanhvien.HoTen = tbTenDoanhNghiep.Text;
            }
            if (string.Compare(tbDiaChi.Text, string.Empty, true) != 0)
                doanhnghiep.DiaChi = tbDiaChi.Text;

            if (string.Compare(tbDienThoai.Text, string.Empty, true) != 0)
            {
                thanhvien.DienThoai = tbDienThoai.Text;
                doanhnghiep.DienThoai = tbDienThoai.Text;
            }

            if (string.Compare(tbWebsite.Text, string.Empty, true) != 0)
                doanhnghiep.WebSite = tbWebsite.Text;

            DoanhNghiepDAO.SuaDN(doanhnghiep);
            ThanhVienDAO.SuaTV(thanhvien);
        }
    }
}
